var data = null
function a(){
    return new Promise(function(resolve, reject) {
        setTimeout(function(){
        console.log('a is done');
        data = 'M3'
        // resolve('DDAMN')
        reject('DAMN')
        },1000)
    })
}

function b(){
    console.log(data);
}

// a().then((res)=>{
//     b()
//     console.log(res);
// })
a().catch((err)=>{
    console.log(err);
});